package com.aktk.battlenole;

import com.aktk.battlenole.GameData.Stages;
import com.aktk.gameelements.Player;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.Menu;
import android.view.MotionEvent;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.View.OnTouchListener;
import android.widget.ImageButton;

public class MainActivity extends Activity {

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        setup();
    }

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        getMenuInflater().inflate(R.menu.activity_main, menu);
        return true;
    }
    
    public void setup() {
    	final ImageButton playButton = (ImageButton) findViewById(R.id.playButton);
    	playButton.setOnTouchListener(new OnTouchListener() {
			
			@Override
			public boolean onTouch(View v, MotionEvent event) {
				if(event.getActionMasked()== 0){
					playButton.setBackgroundResource(R.drawable.play_pressed);
				}else {
					playButton.setBackgroundResource(R.drawable.play);
				}
				return false;
			}
		});
    	
    	playButton.setOnClickListener(new OnClickListener() {
			
			@Override
			public void onClick(View v) {
				Intent i = new Intent(MainActivity.this, PlayerSelectActivity.class);
                startActivity (i);
			}
		});
    	
    	final ImageButton instructionButton = (ImageButton) findViewById(R.id.instructionButton);
    	instructionButton.setOnTouchListener(new OnTouchListener() {
			
			@Override
			public boolean onTouch(View v, MotionEvent event) {
				if(event.getActionMasked()== 0){
					instructionButton.setBackgroundResource(R.drawable.instructions_pressed);
				}else {
					instructionButton.setBackgroundResource(R.drawable.instructions);
				}
				return false;
			}
		});
    	
    	instructionButton.setOnClickListener(new OnClickListener() {
			
			@Override
			public void onClick(View v) {
				Intent i = new Intent(MainActivity.this, InstructionActivity.class);
        		startActivity (i);
				
			}
		});
    	
    	final ImageButton aboutButton = (ImageButton) findViewById(R.id.aboutButton);
    	aboutButton.setOnTouchListener(new OnTouchListener() {
			
			@Override
			public boolean onTouch(View v, MotionEvent event) {
				if(event.getActionMasked()== 0){
					aboutButton.setBackgroundResource(R.drawable.about_pressed);
				}else {
					aboutButton.setBackgroundResource(R.drawable.about);
				}
				
				Intent i = new Intent(MainActivity.this, AboutActivity.class);
                startActivity (i);
				return false;
			}
		});
    	
    	aboutButton.setOnClickListener(new OnClickListener() {
			
			@Override
			public void onClick(View v) {
				setContentView(R.layout.activity_about);				
			}
			
		});
    }
}
